<html>
<head>
<title>event.keyCode</title>
<SCRIPT LANGUAGE="Javascript">
<!--
function keyCodeprintByOnkeydown() {
var keyCode = window.event.keyCode;
var keyChar = String.fromCharCode(window.event.keyCode);
var print = keyChar + " : " + keyCode + "<br />";
document.getElementById("printKeyCodeByOnkeydown").innerHTML += print;
}
function keyCodeprintByOnkeypress() {
var keyCode = window.event.keyCode;
var keyChar = String.fromCharCode(window.event.keyCode);
var print = keyChar + " : " + keyCode + "<br />";
document.getElementById("printKeyCodeByOnkeypress").innerHTML += print;
}
document.onkeydown = keyCodeprintByOnkeydown;
document.onkeypress = keyCodeprintByOnkeypress;
//-->
</SCRIPT>
</head>
<body>
<div id="printKeyCodeByOnkeydown" style="float:left; width:45%; border:1px solid red; margin-left:10px; text-align:center;">Onkeydown<br /></div>
<div style="width:20px;float:left;"></div>
<div id="printKeyCodeByOnKeypress" style="float:left; width:45%; border:1px solid blue; text-align:center;">Onkeypress<br /></div>
</body>
</html>